#coding: utf-8
class CulturalHeritage::CareAndMaintenanceType < ActiveRecord::Base
   has_many :obj_care_and_maintenance, :class_name => 'CulturalHeritage::CareAndMaintenance'
  default_scope where("deleted = 0")
  validates :name, :presence => {:message => "El nombre es requerido"}
  validates :description, :presence => {:message => "La descripcion es requerida"}

  def erasable
    care = CulturalHeritage::CareAndMaintenance.count_care_and_maintenance_type_dependencies(id)
    if care>0
      return "Imposible borrar. Existen dependencias en cuidado y mantenimiento"      
    end
    return nil
  end
  
end
